def calculate(num1,num2,operator):
    if operator == '+':
        return num1 + num2
    elif operator == '-':
        return num1 - num2
    elif operator == '*':
        return num1 * num2
    elif operator == '/':
        return num1 / num2
    else:
        return None


while True:
    try:
        # 获取用户输入的值和运算符号
        num1 = int(input("请输入第一个数："))
        operator = input("+,-,*,/")
        num2 = int(input("请输入第二个数："))

        # 调用calculate函数来执行运算结果
        result = calculate(num1,num2,operator)
        if result is not None:
            print("计算结果为：",result)
        else:
            print("计算错误，请重树输入")
        
        # 判断运算是否继续
        while True:
            choice = input("是否继续？(yes/no) ")
            if choice == "yes":
                print("继续执行...")
            # 在这里添加继续执行的代码
            elif choice == "no":
                print("程序结束")
                break
            else:
                print("无效的输入，请输入yes或no")

    except ValueError as a:
        print("发生异常：",a)
    except NameError:
        print("标识符没有定义")
    except ZeroDivisionError:
        print("除数不能为0")